#include <iostream>
using namespace std;

const int N = 1e5 + 5, M = N * 32;

int trie[M][2], arr[N], idx;

void insert(int x)
{
    for(int i = 31, p = 0; i >= 0; --i)
    {
        int cur = x >> i & 1;
        if(trie[p][cur] == 0) trie[p][cur] = ++idx;
        p = trie[p][cur];
    }
}

int query(int x)
{
    int ans = 0;
    for(int i = 31, p = 0; i >= 0; --i)
    {
        int cur = x >> i & 1;
        if(trie[p][!cur])
        {
            p = trie[p][!cur];
            ans |= 1 << i;
        }
        else
            p = trie[p][cur];
    }
    return ans;
}

int main()
{
    int n; cin >> n;
    for(int i = 0; i < n; ++i)
    {
        cin >> arr[i];
        insert(arr[i]);
    }
    
    int ans = 0;
    for(int i = 0; i < n; ++i)
        ans = max(ans, query(arr[i]));
    
    cout << ans;
    return 0;
}